<?php

/**
 * This is the model class for table "pesan_notifikasi".
 *
 * The followings are the available columns in table 'pesan_notifikasi':
 * @property string $id_pesan_notifikasi
 * @property string $notifikasi
 * @property string $status
 * @property string $id_pegawai
 * @property string $url
 * @property string $created_date
 *
 * The followings are the available model relations:
 * @property MstPegawai $idPegawai
 */
class PesanNotifikasi extends CActiveRecord
{
	/**
	 * Returns the static model of the specified AR class.
	 * @param string $className active record class name.
	 * @return PesanNotifikasi the static model class
	 */
	public static function model($className=__CLASS__)
	{
		return parent::model($className);
	}

	/**
	 * @return string the associated database table name
	 */
	public function tableName()
	{
		return 'pesan_notifikasi';
	}

	/**
	 * @return array validation rules for model attributes.
	 */
	public function rules()
	{
		// NOTE: you should only define rules for those attributes that
		// will receive user inputs.
		return array(
			array('notifikasi', 'required'),
			array('status', 'length', 'max'=>45),
			array('id_pegawai', 'length', 'max'=>20),
			array('url', 'length', 'max'=>150),
			array('created_date', 'safe'),
			// The following rule is used by search().
			// Please remove those attributes that should not be searched.
			array('id_pesan_notifikasi, notifikasi, status, id_pegawai, url, created_date', 'safe', 'on'=>'search'),
		);
	}

	/**
	 * @return array relational rules.
	 */
	public function relations()
	{
		// NOTE: you may need to adjust the relation name and the related
		// class name for the relations automatically generated below.
		return array(
			'idPegawai' => array(self::BELONGS_TO, 'MstPegawai', 'id_pegawai'),
		);
	}

	/**
	 * @return array customized attribute labels (name=>label)
	 */
	public function attributeLabels()
	{
		return array(
			'id_pesan_notifikasi' => 'Id Pesan Notifikasi',
			'notifikasi' => 'Notifikasi',
			'status' => 'Status',
			'id_pegawai' => 'Id Pegawai',
			'url' => 'Url',
			'created_date' => 'Created Date',
		);
	}

	/**
	 * Retrieves a list of models based on the current search/filter conditions.
	 * @return CActiveDataProvider the data provider that can return the models based on the search/filter conditions.
	 */
	public function search()
	{
		// Warning: Please modify the following code to remove attributes that
		// should not be searched.

		$criteria=new CDbCriteria;

		$criteria->compare('id_pesan_notifikasi',$this->id_pesan_notifikasi,true);
		$criteria->compare('notifikasi',$this->notifikasi,true);
		$criteria->compare('status',$this->status,true);
		$criteria->compare('id_pegawai',$this->id_pegawai,true);
		$criteria->compare('url',$this->url,true);
		$criteria->compare('created_date',$this->created_date,true);

		return new CActiveDataProvider($this, array(
			'criteria'=>$criteria,
		));
	}
}